<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
 <head>
  <title>inputEx - Lenses</title>

<!-- YUI CSS -->
<link rel="stylesheet" type="text/css" href="../lib/yui/reset-fonts/reset-fonts.css">
<link rel="stylesheet" type="text/css" href="../lib/yui/container/assets/container.css"> 
<link rel="stylesheet" type="text/css" href="../lib/yui/assets/skins/sam/skin.css">

<!-- InputEx CSS -->
<link type='text/css' rel='stylesheet' href='../css/inputEx.css' />

<!-- Demo CSS -->
<link rel="stylesheet" type="text/css" href="css/demo.css"/>
<link rel="stylesheet" type="text/css" href="css/dpSyntaxHighlighter.css">

 </head>

 <body>

<h1>inputEx - Lenses Usage</h1>


<!-- Example 1 -->
<div class='exampleDiv'>

	<h2>Basic lens creation</h2>
	
	<p>Use the following code to create a basic inputEx lens.</p>

	<div class='demoContainer' id='container1'></div>

	<div class='codeContainer'>
		<textarea name="code" class="JScript">
			var g = new inputEx.Lens({
				parentEl: 'container1',
				fields: [
					{ typeInvite: 'Firstname',name: 'firstname'  },  
					{ typeInvite: 'Lastname', name: 'lastname' },
					{ typeInvite: 'Email', name: 'email' },
					{ type: 'url', name: "picUrl", typeInvite: 'url' },
					{ type: 'map', name: "position", width: '800px', api: 'google'}
				],
				value: {
					firstname: 'Lena',
					email: 'lena@doe.org',
					picUrl: 'http://www.limsi.fr/Individu/vezien/lena.jpg',
					position: {"lat":48.821332549646634,"lon":1.47216796875,"nzoom":6,"uzoom":-6}
				},



				lens: "<div class='field-picUrl'></div>"+
							"<div style='float: left;'><div class='field-firstname'></div></div>"+
							"<div style='float: left;'><div class='field-lastname'></div></div>"+
							"<div style='clear: both;'></div>"+
							"<div class='field-email'></div>"+
							"<div class='field-position'></div>",

				visus: [
					null,
					null,
					{ visuType: 'func', func: function(val) { return "<a href='mailto:"+val+"'>"+val+"</a>"; } },
					{ visuType: 'func', func: function(val) { return '<img src="'+val+'" style="width: 128px; height: 128px;">'; } },
					{ visuType: 'func', func: function(val) { return 'lat:'+val.lat+',long:'+val.lon; } }
				]
			});
		</textarea>
	</div>

</div>



<!-- YUI Library -->
<script type="text/javascript" src="../lib/yui/utilities/utilities.js"></script>
<script type="text/javascript" src="../lib/yui/container/container-min.js"></script>

<!-- InputEx -->
<script src="../js/inputex.js"  type='text/javascript'></script>
<script src="../js/mixins/choice.js"  type='text/javascript'></script>
<script src="../js/Field.js"  type='text/javascript'></script>
<script src="../js/Group.js"  type='text/javascript'></script>
<script src="../js/Visus.js"  type='text/javascript'></script>
<script src="../js/fields/Lens-beta.js"  type='text/javascript'></script>
<script src="../js/fields/StringField.js"  type='text/javascript'></script>
<script src="../js/fields/SelectField.js"  type='text/javascript'></script>
<script src="../js/fields/EmailField.js"  type='text/javascript'></script>
<script src="../js/fields/UrlField.js"  type='text/javascript'></script>
<script src="../js/fields/ListField.js"  type='text/javascript'></script>
<script src="../js/widgets/Button.js"  type='text/javascript'></script>
<script src="../js/fields/InPlaceEdit.js"  type='text/javascript'></script>
<script src="../js/fields/MapField.js"  type='text/javascript'></script>

<script>

YAHOO.util.Event.onDOMReady( function() {
	
	// Required for the UrlField and ListField
	inputEx.spacerUrl = "../images/space.gif";
	
	inputEx.MapFieldGlobals['api'] = 'google';
	inputEx.MapFieldGlobals['api_key'] = {
		'localhost' : 'ABQIAAAADeqGsYygYHMVWXMDJEowhBRA0pJg_vyJNqxN8QciTwW1nvTY9xTHCJ6F7R04FjG06dKgcV5wpIxzZQ',
		'javascript.neyric.com' : ''
	};

	// Example 1
	var g = new inputEx.Lens({
		parentEl: 'container1',
		fields: [
			{ typeInvite: 'Firstname',name: 'firstname' },
			{ typeInvite: 'Lastname', name: 'lastname' },
			{ typeInvite: 'Email', name: 'email' },
			{ type: 'url', name: "picUrl", typeInvite: 'url' },
			{ type: 'map', name: "position", width: '800px', api: 'google'}
		],
		value: {
			firstname: 'Lena',
			email: 'lena@doe.org',
			picUrl: 'http://www.limsi.fr/Individu/vezien/lena.jpg',
			position: {"lat":48.821332549646634,"lon":1.47216796875,"nzoom":6,"uzoom":-6}
		},
		
		
		
		lens: "<div class='field-picUrl'></div>"+
					"<div style='float: left;'><div class='field-firstname'></div></div>"+
					"<div style='float: left;'><div class='field-lastname'></div></div>"+
					"<div style='clear: both;'></div>"+
					"<div class='field-email'></div>"+
					"<div class='field-position'></div>",
					
		visus: [
			null,
			null,
			{ visuType: 'func', func: function(val) { return "<a href='mailto:"+val+"'>"+val+"</a>"; } },
			{ visuType: 'func', func: function(val) { return '<img src="'+val+'" style="width: 128px; height: 128px;">'; } },
			{ visuType: 'func', func: function(val) { return 'lat:'+val.lat+',long:'+val.lon; } }
		]
	});
	
});

</script>

<script src="js/dpSyntaxHighlighter.js"></script>
<script language="javascript"> 
dp.SyntaxHighlighter.HighlightAll('code');
</script>

 </body>
</html>